const util = require("../../utils/util")

Page({
  data: {
    menus: [{
        'id': 0,
        'icon': '../../images/mine/kefu.png',
        'title': '咨询客服'
      },
      {
        'id': 1,
        'icon': '../../images/mine/dingdan.png',
        'title': '我的订单'
      },
      {
        'id': 2,
        'icon': '../../images/mine/haoyou.png',
        'title': '分享好友'
      },
      {
        'id': 3,
        'icon': '../../images/mine/join.png',
        'title': '推广合作'
      },
    ],
    show: false,
    actions: [{
        name: '选项',
      },
      {
        name: '选项',
      },
      {
        name: '选项',
        subname: '描述信息',
        openType: 'share',
      },
    ],
    shareInfos: [
      {'id': 0, 'picUrl': '../../images/fenxiang/wechatfriend.png', 'title': '分享到微信'},
      {'id': 1, 'picUrl': '../../images/fenxiang/wechatmoments.png', 'title': '分享到朋友圈'},
      {'id': 2, 'picUrl': '../../images/fenxiang/copyurl.png', 'title': '复制链接'},
    ],
    isShowKefu: false,
  },
  onLoad(options) {

  },
  toCollect(e) {
    console.log("cl")
    util.redirect({
      url: 'cm',
      to: 'collect'
    })
  },
  toMistake(e) {
    util.redirect({
      url: 'cm',
      to: 'mistake'
    })
  },
  showKefu() {
    this.setData({
      isShowKefu: true,
    })
  },
  showShare() {
    this.setData({
      show: true,
    })
  },
  handleTap(e) {
    let id  = e.currentTarget.dataset.id
    switch(id) {
      case 0:
        this.showKefu()
        break
      case 1:
        break
      case 2:
        this.showShare()
        break
      case 3:
        break
    }
  },
  onClose() {
    this.setData({
      show: false
    });
  },
  onKefuClose() {
    this.setData({
      isShowKefu: false
    });
  },
  onSelect(event) {
    console.log(event.detail);
  },
})